﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib prefix="c"
uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
  <head>
    <link rel="stylesheet" href="${ctx}/common/common.css" />
    <title>Title</title>

    <link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/style/admin.css" media="all" />
    <link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/layui/css/layui.css" media="all" />
    <script src="${ctx}/common/plugins/layuiadmin/layui/layui.js"></script>

    <script src="${ctx}/common/plugins/publicJs/publicJs.js"></script>
    <style>
      .layui-body {
        overflow-y: scroll;
      }
      .layui-input-block .layui-unselect {
        width: 100%;
      }
    </style>
  </head>
  <body>
    <!--主体内容层-->
    <div class="layui-fluid">
      <div class="layui-row layui-col-space15">
        <div class="layui-col-md12 layui-col-space15">
          <form class="layui-form">
            <!--输入框内容盒子-->
            <div class="layui-col-md12">
              <!--城市选择通用下拉框-->
              <div class="layui-col-md4">
                <label class="layui-form-label">营业执照预警阈值：</label>
                <div class="layui-input-block">
                  <select name="yy" id="yy">
                    <option value="">正常</option>
                    <option value="1">一月后过期</option>
                    <option value="2">二月后过期</option>
                    <option value="3">三月后过期</option>
                    <option value="4">四月后过期</option>
                    <option value="5">五月后过期</option>
                    <option value="6">六月后过期</option>
                  </select>
                </div>
              </div>
              <!--城市选择通用下拉框-->
              <div class="layui-col-md4">
                <label class="layui-form-label">生产许可预警阈值：</label>
                <div class="layui-input-block">
                  <select name="sc" id="sc">
                    <option value="">正常</option>
                    <option value="1">一月后过期</option>
                    <option value="2">二月后过期</option>
                    <option value="3">三月后过期</option>
                    <option value="4">四月后过期</option>
                    <option value="5">五月后过期</option>
                    <option value="6">六月后过期</option>
                  </select>
                </div>
              </div>

              <!-- 							  			<from class="layui-form">
				<div class="layui-col-md3">
	    	<label class="layui-form-label">溯源类型</label>
			<div class="layui-input-block">
				<select name="traceabilityType" lay-filter="aihao">
					<option value=""></option>

						<option value="1">个体溯源</option>

						<option value="2">批量溯源</option>

				</select>
				<div class="layui-unselect layui-form-select layui-form-selected"><div class="layui-select-title"><input type="text" placeholder="请选择" value="" readonly="" class="layui-input layui-unselect"><i class="layui-edge"></i></div><dl class="layui-anim layui-anim-upbit"><dd lay-value="" class="layui-select-tips">请选择</dd><dd lay-value="1" class="">个体溯源</dd><dd lay-value="2" class="">批量溯源</dd></dl></div>
			</div>
		</div>
		</from>	 -->
            </div>

            <!--通用按钮盒子-->
            <div class="layui-col-md12" style="padding-top: 10px; padding-bottom: 10px">
              <!--通用table表格-->
              <!--          <div class="layui-btn-group demoTable">
                        <button class="layui-btn layui-btn-sm" type="button" data-type="addPerson">
                            <i class="layui-icon">&#xe654;</i>
                        </button>
                        删除
                        <button class="layui-btn layui-btn-sm" type="button" data-type="delPersonSelect">
                            <i class="layui-icon">&#xe640;</i>
                        </button>
                    </div> -->
              <div style="float: right" class="layui-btn-group paramBtn">
                <button data-type="reloadLabel" type="button" class="layui-btn layui-btn-sm layui-btn-danger">
                  查询
                </button>
                <button data-type="resetLabel" type="reset" class="layui-btn layui-btn-sm layui-btn-danger">
                  重置
                </button>
              </div>
            </div>
          </form>

          <table
            class="layui-table"
            id="labelReload"
            lay-data="{ url:'${ctx}/warning/warningEnterprise/findEnterprisePage', page:true,groups:5}"
            lay-filter="demo"
          >
            <thead>
              <tr>
                <!--  <th lay-data="{type:'checkbox', fixed: 'left'}"></th> -->
                <th lay-data="{field:'name',width:350}">企业名称</th>
                <th lay-data="{field:'yyCode'}">营业执照代码</th>
                <th lay-data="{field:'yyDate',sort:true,toolbar:'#yy1'}">营业执照有效期</th>
                <th lay-data="{field:'scCode'}">生产许可证代码</th>
                <th lay-data="{field:'scDate',sort:true,toolbar:'#sc1'}">生产许可有效期</th>
                <th lay-data="{field:'contact'}">联系人</th>
                <th lay-data="{field:'phone'}">联系人电话</th>
                <th lay-data="{field:'stat',toolbar:'#barDemo',width:120}">操作</th>
              </tr>
            </thead>
          </table>
        </div>
      </div>
    </div>
    <script type="text/html" id="barDemo">
      <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="check">详细</a>
    </script>
    <script id="createTime" type="text/html">
      {{# return layui.getDate(d.create_time, 'yyyy-MM-dd hh:mm:ss');}}
    </script>
    <script type="text/html" id="yy1">
      {{# if(d.yyDate !=null&&d.yyDate !=''){ }} {{# if(d.yyguoqi == "0"){}}
      <img src="${ctx}/common/imgs/u4266.png" />
      {{d.yyDate}} {{# } }} {{# if(d.yyguoqi == "1"){}}
      <img src="${ctx}/common/imgs/u4268.png" />
      {{d.yyDate}} {{# } }} {{# } }}
    </script>
    <script type="text/html" id="sc1">
      {{# if(d.scDate !=null&&d.scDate !=''){ }} {{# if(d.scguoqi == "0"){}}
      <img src="${ctx}/common/imgs/u4266.png" />
      {{d.scDate}} {{# } }} {{# if(d.scguoqi == "1"){}}
      <img src="${ctx}/common/imgs/u4268.png" />
      {{d.scDate}} {{# } }} {{# } }}
    </script>
  </body>
  <script>
    layui.use("table", function () {
      var loading = layer.msg("数据加载中...");
      var table = layui.table;
      table.render({
        done: function () {
          layer.close(loading);
        },
      });
      //监听filter为demo的table中的工具条
      table.on("tool(demo)", function (obj) {
        var data = obj.data;
        if (obj.event === "check") {
          window.location.href = "${ctx}/warning/warningEnterprise/enterpriseDetail?enterpriseId=" + obj.data.id;
        }
      });

      var $ = layui.$,
        active = {
          reloadLabel: function () {
            //条件查询
            var yy = document.getElementById("yy").value;
            var sc = document.getElementById("sc").value;
            table.reload("labelReload", {
              where: {
                yy: yy,
                sc: sc,
              },
            });
          },
          resetLabel: function () {
            table.reload("labelReload", {
              where: {
                yy: "",
                sc: "",
              },
            });
          },
        };

      $(".demoTable .layui-btn").on("click", function () {
        var type = $(this).data("type");
        active[type] ? active[type].call(this) : "";
      });
      //给按钮绑定active中的方法
      $(".paramBtn .layui-btn").on("click", function () {
        var type = $(this).data("type");
        //查看是active这个json中是否有type这个方法，如果有调用，如果没有不知心；
        active[type] ? active[type].call() : "";
      });
    });
  </script>
</html>
